-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clients): support util functions to consume response streams #3795
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AllanZhengYP
force-pushed
the
stream-improvement-serde
branch
from
July 13, 2022 17:59
44c4d01
to
553b0db
Compare
AllanZhengYP
force-pushed
the
stream-improvement-serde
branch
from
August 29, 2022 21:51
553b0db
to
1340185
Compare
gosar
reviewed
Aug 30, 2022
AllanZhengYP
force-pushed
the
stream-improvement-serde
branch
4 times, most recently
from
August 31, 2022 08:06
64f8c55
to
2bd12ea
Compare
AllanZhengYP
force-pushed
the
stream-improvement-serde
branch
from
September 2, 2022 06:42
2bd12ea
to
d147b9a
Compare
kuhe
approved these changes
Sep 12, 2022
continued in #3977 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Associated to smithy-lang/smithy-typescript#571
Resolves: #1877
Description
Now if the deserialized object has streaming blob member(SSDK's input or SDK's output), customers can tranform the stream into string by
Or get the binary data by:
Or transform to runtime-agnostic WebStream by:
The output stream payload's interface is still assignable to the stream payload shape in the input, so this will work:
At the same time, the payload stream is still an instance of the runtime-specific stream implementation, i.e. Stream.Readable in Node.js, ReadableStream in browsers and Blob in React Native. So the code like below will still work:
Note: since the streaming data can only be read once, and simplify the concurrency model, any of the transform methods to the stream can only be called once.
Testing
Unit test;
Integration test(PR to follow up)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.